package com.tool.write.simple;

import com.alibaba.excel.EasyExcel;
import com.tool.write.entity.PersonConverterData;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author niuyicong
 * @date 2024/10/19  0:21:13
 * @description
 */
public class SimpleExcelFormatConverter {
    public static void main(String[] args) {
        String fileName = "个人信息converter" + System.currentTimeMillis() + ".xlsx";

        EasyExcel.write(fileName, PersonConverterData.class)
                .sheet("模板")
                .doWrite(() -> {
                    return data();
                });
    }

    public static List<PersonConverterData> data(){
        List<PersonConverterData> data = new ArrayList<>();
        PersonConverterData person1 = new PersonConverterData("niu",25,new Date(),5500.0,"男");
        PersonConverterData person2 = new PersonConverterData("niuniu",26,new Date(),5500.0,"男");
        PersonConverterData person3 = new PersonConverterData("niuniuniu",27,new Date(),5500.0,"男");
        data.add(person1);
        data.add(person2);
        data.add(person3);
        return data;
    }
}
